package sjms.behavior.observer;

/**
 * @ClassName:
 * @Description:
 * @Author fcb
 * @Date 2020/6/9 13:14
 */
public class ConcreteObserver implements Observer {

    private ConcreteSubject subject;

    private String state;

    public ConcreteObserver(ConcreteSubject subject){
        this.subject = subject;
        this.subject.attach(this);
    }

    @Override
    public void update() {
        this.state = subject.getState();
        System.out.println("state："+ subject.getState());
    }
}
